using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ConversionTools._JSON
{
    /// <summary>
    /// <para>JSON To Features</para>
    /// <para>Converts feature collections in an Esri JSON (.json) file or GeoJSON (.geojson) file to a feature class.</para>
    /// <para>将 Esri JSON （.json） 文件或 GeoJSON （.geojson） 文件中的要素集合转换为要素类。</para>
    /// </summary>    
    [DisplayName("JSON To Features")]
    public class JSONToFeatures : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public JSONToFeatures()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_json_file">
        /// <para>Input JSON or GeoJSON</para>
        /// <para><xdoc>
        ///   <para>The input JSON or GeoJSON file to convert to a feature class.</para>
        ///   <para>The input file extension determines the conversion routine used by the tool. Esri JSON formatted files must use the .json extension, and GeoJSON files must use the .geojson extension for proper conversion to occur.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要转换为要素类的输入 JSON 或 GeoJSON 文件。</para>
        ///   <para>输入文件扩展名确定该工具使用的转换例程。Esri JSON 格式的文件必须使用 .json 扩展名，而 GeoJSON 文件必须使用 .geojson 扩展名才能进行正确的转换。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_features">
        /// <para>Output Feature Class</para>
        /// <para>The output feature class created to contain the features converted from the input JSON or GeoJSON file.</para>
        /// <para>为包含从输入 JSON 或 GeoJSON 文件转换而来的要素而创建的输出要素类。</para>
        /// </param>
        public JSONToFeatures(object _in_json_file, object _out_features)
        {
            this._in_json_file = _in_json_file;
            this._out_features = _out_features;
        }
        public override string ToolboxName => "Conversion Tools";

        public override string ToolName => "JSON To Features";

        public override string CallName => "conversion.JSONToFeatures";

        public override List<string> AcceptEnvironments => ["scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_json_file, _out_features, _geometry_type.GetGPValue()];

        /// <summary>
        /// <para>Input JSON or GeoJSON</para>
        /// <para><xdoc>
        ///   <para>The input JSON or GeoJSON file to convert to a feature class.</para>
        ///   <para>The input file extension determines the conversion routine used by the tool. Esri JSON formatted files must use the .json extension, and GeoJSON files must use the .geojson extension for proper conversion to occur.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要转换为要素类的输入 JSON 或 GeoJSON 文件。</para>
        ///   <para>输入文件扩展名确定该工具使用的转换例程。Esri JSON 格式的文件必须使用 .json 扩展名，而 GeoJSON 文件必须使用 .geojson 扩展名才能进行正确的转换。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input JSON or GeoJSON")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_json_file { get; set; }


        /// <summary>
        /// <para>Output Feature Class</para>
        /// <para>The output feature class created to contain the features converted from the input JSON or GeoJSON file.</para>
        /// <para>为包含从输入 JSON 或 GeoJSON 文件转换而来的要素而创建的输出要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_features { get; set; }


        /// <summary>
        /// <para>Geometry Type</para>
        /// <para><xdoc>
        ///   <para>The geometry type to convert from GeoJSON to features. This option is only used when the input is a GeoJSON file. If the GeoJSON file does not contain any of the selected geometry type, the output feature class will be empty.</para>
        ///   <bulletList>
        ///     <bullet_item>Point—Convert any points to features.</bullet_item><para/>
        ///     <bullet_item>Multipoint—Convert any multipoints to features.</bullet_item><para/>
        ///     <bullet_item>Polyline—Convert any polylines to features.</bullet_item><para/>
        ///     <bullet_item>Polygon—Convert any polygons to features.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要从 GeoJSON 转换为要素的几何类型。仅当输入是 GeoJSON 文件时，才使用此选项。如果 GeoJSON 文件不包含任何选定的几何类型，则输出要素类将为空。</para>
        ///   <bulletList>
        ///     <bullet_item>点 - 将任意点转换为要素。</bullet_item><para/>
        ///     <bullet_item>多点 - 将任意多点转换为要素。</bullet_item><para/>
        ///     <bullet_item>折线 - 将任何折线转换为要素。</bullet_item><para/>
        ///     <bullet_item>面 - 将任意面转换为要素。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Geometry Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _geometry_type_value _geometry_type { get; set; } = _geometry_type_value._POLYGON;

        public enum _geometry_type_value
        {
            /// <summary>
            /// <para>Point</para>
            /// <para>Point—Convert any points to features.</para>
            /// <para>点 - 将任意点转换为要素。</para>
            /// </summary>
            [Description("Point")]
            [GPEnumValue("POINT")]
            _POINT,

            /// <summary>
            /// <para>Multipoint</para>
            /// <para>Multipoint—Convert any multipoints to features.</para>
            /// <para>多点 - 将任意多点转换为要素。</para>
            /// </summary>
            [Description("Multipoint")]
            [GPEnumValue("MULTIPOINT")]
            _MULTIPOINT,

            /// <summary>
            /// <para>Polygon</para>
            /// <para>Polygon—Convert any polygons to features.</para>
            /// <para>面 - 将任意面转换为要素。</para>
            /// </summary>
            [Description("Polygon")]
            [GPEnumValue("POLYGON")]
            _POLYGON,

            /// <summary>
            /// <para>Polyline</para>
            /// <para>Polyline—Convert any polylines to features.</para>
            /// <para>折线 - 将任何折线转换为要素。</para>
            /// </summary>
            [Description("Polyline")]
            [GPEnumValue("POLYLINE")]
            _POLYLINE,

        }

        public JSONToFeatures SetEnv(object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}